﻿using Demo.Entity;
using Demo.Filter;
using LightWadf.Filter;
using LightWadf.Processor;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Demo.Processor
{
    public class TestRestfulProcessor : RestfulProcessor
    {
        public override void InitRouteRule()
        {
            this.AddRouteRule("/restful/test", new Func<HttpContext, object>(this.Test), "Test");
            this.AddRouteRule("restful/user", new Func<HttpContext, object>(this.GetUser), "GetUser");
        }

        [CacheFilter]
        public string Test(HttpContext context)
        {
            return "test restful string";
        }

        public User GetUser(HttpContext context)
        {
            return new User { Name = "test", Age = 10 };
        }
    }
}